<template>
  <div>
    <div align="center">
      <label size="large" label-width="280px">— — — — — — — — — — — — —</label><br/>
      <label size="large" label-width="280px">* * * 液化气充装站泄漏爆炸危害模型 * * *</label><br/>
      <label size="large" label-width="280px">— — — — — — — — — — — — —</label>
    </div>
    <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="300px">
      <el-form-item label="可燃气体混合物喷射直径（单位：m）" prop="d">
        <el-input v-model="formData.d" placeholder="请输入可燃气体混合物喷射直径（单位：m）" show-word-limit clearable
                  :style="{width: '80%'}"></el-input>
      </el-form-item>
      <el-form-item label="管道内介质压力（单位：Pa）" prop="p">
        <el-input v-model="formData.p" placeholder="请输入管道内介质压力（单位：Pa）" show-word-limit clearable
                  :style="{width: '80%'}"></el-input>
      </el-form-item>
      <el-form-item label="LPG被挖断天然扡管道位置" prop="position">
        <el-input v-model="formData.position" placeholder="请输入LPG被挖断天然扡管道位置" show-word-limit clearable
                  :style="{width: '80%'}"></el-input>
      </el-form-item>
      <el-form-item label="可燃气体温度T（单位：K）" prop="t">
        <el-input v-model="formData.t" placeholder="请输入可燃气体温度T（单位：K）" show-word-limit clearable
                  :style="{width: '80%'}"></el-input>
      </el-form-item>
      <el-form-item label="泄露时间(单位：s)（秒）" prop="time">
        <el-input v-model="formData.time" placeholder="请输入泄露时间(单位：s)（秒）" show-word-limit clearable
                  :style="{width: '80%'}"></el-input>
      </el-form-item>
      <el-form-item size="large">
        <el-button type="primary" @click="submitForm">提交</el-button>
        <el-button @click="resetForm">重置</el-button>
      </el-form-item>
    </el-form>
    <el-dialog
      title="评估结果"
      :visible.sync="centerDialogVisible"
      width="30%"
      center>
      <span>重伤区半径（单位：m）:{{Rd05}};喷射火热辐射对人的致死率:{{pdi}};死亡半径（单位：m）:{{R05}};轻伤半径（单位：m）:{{Rd001}};喷射火焰长度（单位：m）：{{L}}；喷射火火焰宽度：{{Ds}}</span>
      <span slot="footer" class="dialog-footer">
    <el-button @click="centerDialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
  </span>
    </el-dialog>
  </div>
</template>
<script>
  import {handleRQGD16} from "../../../api/edu/risk";

  export default {
    components: {},
    props: [],
    data() {
      return {
        centerDialogVisible : false,
        formData: {
          d: '',
          p: '',
          position: '',
          t: '',
          time: '',
        },
        rules: {
          d: [{
            required: true,
            message: '请输入可燃气体混合物喷射直径（单位：m）',
            trigger: 'blur'
          }],
          p: [{
            required: true,
            message: '请输入管道内介质压力（单位：Pa）',
            trigger: 'blur'
          }],
          position: [{
            required: true,
            message: '请输入LPG被挖断天然扡管道位置',
            trigger: 'blur'
          }],
          t: [{
            required: true,
            message: '请输入可燃气体温度T（单位：K）',
            trigger: 'blur'
          }],
          time: [{
            required: true,
            message: '请输入泄露时间(单位：s)（秒）',
            trigger: 'blur'
          }],
        },
      }
    },
    computed: {},
    watch: {},
    created() {},
    mounted() {},
    methods: {
      submitForm() {
        handleRQGD16(this.formData).then(response => {
          console.log(response)
           this.Rd05 = response.Rd05;
          this.pdi = response.pdi;
          this.R05 = response.R05;
          this.Rd001 = response.Rd001;
          this.L = response.L;
          this.Ds = response.Ds;
          this.centerDialogVisible = true
        }).catch((error) => {
          console.log(error);
        });
      },
      resetForm() {
        this.$refs['elForm'].resetFields()
      },
    }
  }

</script>
<style>
</style>
